package com.linzelin.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo implements Controller {
    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        ModelAndView view = new ModelAndView();

        //下面就负责写业务代码了
        String result = "HelloSpringMVC";

        //业务代码
        view.addObject("msg",result);

        //视图跳转
        view.setViewName("Hello");

        return view;
    }
}
